package com.cc.service.iml;

import com.cc.mapper.CommentMapper;
import com.cc.model.EbComment;
import com.cc.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class CommentServiceImpl implements CommentService {
    @Autowired
    private CommentMapper commentMapper;
    @Override
    public List<EbComment> list(Integer page, Integer pageSize) {
        return commentMapper.findByPage((page-1) *pageSize,pageSize);
    }

    @Override
    public int save(EbComment ebComment) {
        return commentMapper.save(ebComment);
    }

    @Override
    public int getMaxPage(int pageSize) {
        return commentMapper.getMaxPage(pageSize);
    }


    @Override
    public int deleteByPk(int id) {
        return commentMapper.delete(id);
    }

    @Override
    public EbComment selectByCondition(int ecId) {
        return commentMapper.findById(ecId);
    }

    @Override
    public int updateById(EbComment ebComment) {
        return commentMapper.updateByPrimaryKey(ebComment);
    }

}
